import com.ly.common.servlet.BaseServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@WebServlet("/servlet/*")
public class HelloServlet extends BaseServlet {

    // 该方法不是继承，但是要求1接收请求和响应对象
    // 该方法的返回结果会自动地转换成 json 格式
    // http://127.0.0.1:8080/C118_S3_play_myinfo_war/servlet/hello

    public String hello(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        return "hello world";
    }

    // http://127.0.0.1:8080/C118_S3_play_myinfo_war/servlet/say
    public Map<String,Object> say(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Map<String,Object> ret = new HashMap<>();
        ret.put("name","zhangsan");
        ret.put("age","18");
        return ret;
    }
}
